import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import WindiCss from 'vite-plugin-windicss'
import path from 'path'
// https://vitejs.dev/config/

export default defineConfig({
  publicPath: '/',
  outputDir: 'dist',
  assetsDir: 'static',
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src'),
      '@i': path.resolve(__dirname, './src/assets')
    }
  },
  server: {
    host: '0.0.0.0',
    port: 3001,
    // 请求代理
    proxy: {
      '/admin': {
        // 这里的地址是后端数据接口的地址
        target: 'http://localhost:8877/',
        //rewrite: (path) => path.replace(/^\/admin/, ''),
        // 允许跨域
        changeOrigin: true

      }
    }
  },
  plugins: [vue(), WindiCss()]
})
